package 正则表达式;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Reg10 {
    public static void main(String[] args) {
        String s="<div>myok,java-1000</div><p>java</p><div>hello,java</div>";
        System.out.println(s.replaceAll("(<div>.*?)java(.*</div>)","$1java17$2"));

        //将div标签中的Java修改成Java17
        Pattern pattern=Pattern.compile("(<div>.*?)java(.*</div>)");
        Matcher matcher= pattern.matcher(s);
        while(matcher.find()){
            System.out.println(matcher.group());
        }

    }
}
